<template>
    <div>
        <!-- 面包屑导航 -->
        <el-breadcrumb separator="/">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item><a href="javascript:void(0);">客户信息</a></el-breadcrumb-item>
        </el-breadcrumb>
        <el-card class="box-card">
            <el-table :data="CustomerList" border stripe :header-cell-style="{background:'#eef1f6',color:'#606266'}">
                <el-table-column prop="cname" label="客户名称">
                </el-table-column>
                <el-table-column prop="address" label="公司地址" width="500px">
                </el-table-column>
                <el-table-column prop="uname" label="联系人姓名">
                </el-table-column>
                <el-table-column prop="phone" label="联系人电话">
                </el-table-column>
                <el-table-column label="操作">
                    <template slot-scope="scope">
                        <!-- 编辑 -->
                        <el-tooltip class="item" effect="dark" content="编辑" placement="top" :enterable="false" v-if="scope.row.auditing != 2">
                            <el-button type="primary" size="mini" @click="UpdatOrder(scope.$index+1, scope.row)">
                                <i class="el-icon-edit"></i>
                            </el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
            </el-table>
            <div class="block">
                <!-- 分页 -->
                <el-pagination @size-change="sizeChange" @current-change="currentChange" :current-page="page" :page-sizes="pagesizes" :page-size="size" :layout="layout" :total="total" background>
                </el-pagination>
            </div>

        </el-card>
    </div>
</template>

<script>
import { customer_info_get } from '../axios_api/api'
export default {
    data() {
        return {
            CustomerList: [],
            // 分页变量
            layout: "total, sizes, prev, pager, next, jumper",
            pagesizes: [10, 30, 50, 100],
            page: 1,
            size: 10,
            total: 0,
        }
    },
    mounted() {
        this.customerInfo();
    },
    methods: {
        currentChange() {
            this.customerInfo();
        },
        sizeChange() {
            this.customerInfo();
        },
        customerInfo() {
            let params = { page: this.page, size: this.size }
            customer_info_get(params).then(resp => {
                if (resp.code === 200) {
                    this.CustomerList = resp.custlist
                    this.total = resp.total
                }
                console.log(resp)
            })
        }
    }
}
</script>

<style>
</style>